"""
自定义异常类
"""
from fastapi import HTTPException, status


class UserNotFoundError(HTTPException):
    """用户未找到异常"""
    def __init__(self, detail: str = "用户不存在"):
        super().__init__(status_code=status.HTTP_404_NOT_FOUND, detail=detail)


class InvalidCredentialsError(HTTPException):
    """无效凭证异常"""
    def __init__(self, detail: str = "用户名或密码错误"):
        super().__init__(status_code=status.HTTP_401_UNAUTHORIZED, detail=detail)


class TokenExpiredError(HTTPException):
    """Token 过期异常"""
    def __init__(self, detail: str = "Token 已过期"):
        super().__init__(status_code=status.HTTP_401_UNAUTHORIZED, detail=detail)


class PermissionDeniedError(HTTPException):
    """权限拒绝异常"""
    def __init__(self, detail: str = "权限不足"):
        super().__init__(status_code=status.HTTP_403_FORBIDDEN, detail=detail)